﻿using System;
using System.Collections.Generic;

using IDAL.AuthModel;
using Model.AuthModel;
using DALFactory.AuthModel;
namespace BLL.AuthModel
{
    /// <summary>
    /// 通用组件，权限模型，业务层，权限
    /// </summary>
    public class AuthBLL
    {
        private IAuth dal = DataAccess.CreateAuth();  

        /// <summary>
        /// 更新权限
        /// </summary>
        /// <param name="moduleID"></param>
        /// <param name="funcList"></param>
        /// <returns></returns>
        public bool UpdateAuth(int moduleID, string funcList) 
        {
            return dal.UpdateAuth(moduleID, funcList);
        }

        /// <summary>
        /// 获取模块对应的权限
        /// </summary>
        /// <param name="moduleID"></param>
        /// <returns></returns>
        public IList<AuthInfo> ListAuthByModule(int moduleID) 
        {
            AuthCondition condition = new AuthCondition();
            condition.ModuleID = moduleID;
            return dal.ListAuth(condition);
        }

        /// <summary>
        /// 获取模块分类对应的权限
        /// </summary>
        /// <param name="moduleTypeID"></param>
        /// <returns></returns>
        public IList<AuthInfo> ListAuthByModuleType(int moduleTypeID)
        {
            AuthCondition condition = new AuthCondition();
            condition.ModuleTypeID = moduleTypeID;
            return dal.ListAuth(condition);
        }
    }
}
